const Admin = require("../models/Admin");
exports.addAdmin = async function (adminObj) {
  const ins = await Admin.create(adminObj);
  return ins.toJSON()
};

exports.deleteAdmin = async function (id) {
    await Admin.destroy({
        where:{
            id
        }
    })
};

exports.updateAdmin = async function (id,adminObj) {
    const result = await Admin.update(adminObj,{
        where:{
            id
        }
    })
    return result
};

exports.login = async function (userAccount,userPwd){
    const result = await Admin.findOne({
        where:{
            userAccount,
            userPwd
        }
    })
    return result
}
